using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._DataManagementTools._Fields
{
    /// <summary>
    /// <para>Convert Time Field</para>
    /// <para>Converts time values stored in a string or numeric field to a date field. The tool can also be used to convert time values stored in string, numeric, or date fields into custom formats such as day of the week and month of the year.</para>
    /// <para>将存储在字符串或数值字段中的时间值转换为日期字段。该工具还可用于将存储在字符串、数字或日期字段中的时间值转换为自定义格式，例如星期几和一年中的月份。</para>
    /// </summary>    
    [DisplayName("Convert Time Field")]
    public class ConvertTimeField : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public ConvertTimeField()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_in_table">
        /// <para>Input Table</para>
        /// <para>The layer or table that contains the field containing the time values that need to be converted.</para>
        /// <para>包含包含需要转换的时间值的字段的图层或表。</para>
        /// </param>
        /// <param name="_input_time_field">
        /// <para>Input Time Field</para>
        /// <para>The field containing the time values. May be of type short, long, float, double, text, or date.</para>
        /// <para>包含时间值的字段。可以是短型、长型、浮点型、双倍型、文本型或日期型。</para>
        /// </param>
        /// <param name="_output_time_field">
        /// <para>Output Time Field</para>
        /// <para>The name of the output field in which the converted time values will be stored.</para>
        /// <para>将在其中存储转换时间值的输出字段的名称。</para>
        /// </param>
        public ConvertTimeField(object _in_table, object _input_time_field, object _output_time_field)
        {
            this._in_table = _in_table;
            this._input_time_field = _input_time_field;
            this._output_time_field = _output_time_field;
        }
        public override string ToolboxName => "Data Management Tools";

        public override string ToolName => "Convert Time Field";

        public override string CallName => "management.ConvertTimeField";

        public override List<string> AcceptEnvironments => ["workspace"];

        public override object[] ParameterInfo => [_in_table, _input_time_field, _input_time_format, _output_time_field, _output_time_type.GetGPValue(), _output_time_format, _out_table];

        /// <summary>
        /// <para>Input Table</para>
        /// <para>The layer or table that contains the field containing the time values that need to be converted.</para>
        /// <para>包含包含需要转换的时间值的字段的图层或表。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Table")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_table { get; set; }


        /// <summary>
        /// <para>Input Time Field</para>
        /// <para>The field containing the time values. May be of type short, long, float, double, text, or date.</para>
        /// <para>包含时间值的字段。可以是短型、长型、浮点型、双倍型、文本型或日期型。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Time Field")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _input_time_field { get; set; }


        /// <summary>
        /// <para>Input Time Format</para>
        /// <para><xdoc>
        ///   <para>The format in which the time values were stored in the input time field. Either a standard time format can be selected from the drop-down list or a custom format can be entered.
        ///   <para>The format strings are case sensitive.</para>
        ///   <bulletList>
        ///     <bullet_item>If the data type of the time field is date, no time format is required.  </bullet_item><para/>
        ///     <bullet_item>If the data type of the time field is numeric (Short, Long, Float, or Double), a list of standard numeric time formats is provided in the drop-down list.  </bullet_item><para/>
        ///     <bullet_item>If the data type of the time field is string, a list of standard string time formats is provided in the drop-down list. For string fields, you can also choose to specify a custom time format. For example, the time values may have been stored in a string field in one of the standard formats such as yyyy/MM/dd HH:mm:ss or in a custom format such as dd/MM/yyyy HH:mm:ss. For the custom format, you can also specify the a.m., p.m. designator. Some commonly used formats are listed below:
        ///       <bulletList>
        ///         <bullet_item>yyyy - Year represented by four digits.      </bullet_item><para/>
        ///         <bullet_item>MM - Month as digits with leading zero for single-digit months.      </bullet_item><para/>
        ///         <bullet_item>MMM - Month as a three-letter abbreviation.      </bullet_item><para/>
        ///         <bullet_item>dd - Day of month as digits with leading zero for single-digit days.      </bullet_item><para/>
        ///         <bullet_item>ddd - Day of week as a three-letter abbreviation.      </bullet_item><para/>
        ///         <bullet_item>hh - Hours with leading zero for single-digit hours; 12-hour clock.      </bullet_item><para/>
        ///         <bullet_item>HH - Hours with leading zero for single-digit hours; 24-hour clock.      </bullet_item><para/>
        ///         <bullet_item>mm - Minutes with leading zero for single-digit minutes.      </bullet_item><para/>
        ///         <bullet_item>ss - Seconds with leading zero for single-digit seconds.      </bullet_item><para/>
        ///         <bullet_item>t - One character time marker string, such as A or P.      </bullet_item><para/>
        ///         <bullet_item>tt - Multicharacter time marker string, such as AM or PM.      </bullet_item><para/>
        ///         <bullet_item>unix_us - Unix time in microseconds.      </bullet_item><para/>
        ///         <bullet_item>unix_ms - Unix time in milliseconds.      </bullet_item><para/>
        ///         <bullet_item>unix_s - Unix time in seconds.      </bullet_item><para/>
        ///         <bullet_item>unix_hex - Unix time in hexadecimal.      </bullet_item><para/>
        ///       </bulletList>
        ///     </bullet_item><para/>
        ///   </bulletList>
        ///   </para>
        /// </xdoc></para>
        /// <para><xdoc>
        /// <para>在输入时间字段中存储时间值的格式。可以从下拉列表中选择标准时间格式，也可以输入自定义格式。
        ///   <para>格式字符串区分大小写。</para>
        ///   <bulletList>
        ///     <bullet_item>如果时间字段的数据类型为日期，则不需要时间格式。</bullet_item><para/>
        ///     <bullet_item>如果时间字段的数据类型为数值（空头、长头、浮点数或双精度），则下拉列表中会提供标准数字时间格式的列表。</bullet_item><para/>
        /// <bullet_item>如果时间字段的数据类型为字符串，则下拉列表中会提供标准字符串时间格式的列表。对于字符串字段，您还可以选择指定自定义时间格式。例如，时间值可能已以标准格式之一（如 yyyy/MM/dd HH：mm：ss）或自定义格式（如 dd/MM/yyyy HH：mm：ss）存储在字符串字段中。对于自定义格式，您还可以指定上午 （a.m.） 和下午 （p.m.） 指示符。下面列出了一些常用的格式：
        ///       <bulletList>
        ///         <bullet_item>yyyy - 用四位数字表示的年份。</bullet_item><para/>
        ///         <bullet_item>MM - 以数字表示的月份，前导为零表示个位数月份。</bullet_item><para/>
        ///         <bullet_item>MMM - 月为三个字母的缩写。</bullet_item><para/>
        ///         <bullet_item>dd - 以数字表示的月份中的某一天，前导为零表示个位数的天数。</bullet_item><para/>
        ///         <bullet_item>ddd - 星期几，为三个字母的缩写。</bullet_item><para/>
        ///         <bullet_item>hh - 前导零的小时数，表示个位数的小时数;12 小时制。     </bullet_item><para/>
        ///         <bullet_item>HH - 前导零的小时数，表示个位数的小时数;24小时制。     </bullet_item><para/>
        ///         <bullet_item>mm - 前导零的分钟数，表示个位数的分钟数。</bullet_item><para/>
        ///         <bullet_item>ss - 前导零的秒数，表示个位数秒。</bullet_item><para/>
        ///         <bullet_item>t - 一个字符的时间标记字符串，例如 A 或 P。</bullet_item><para/>
        ///         <bullet_item>tt - 多字符时间标记字符串，例如 AM 或 PM。</bullet_item><para/>
        ///         <bullet_item>unix_us - 以微秒为单位的 Unix 时间。</bullet_item><para/>
        ///         <bullet_item>unix_ms - 以毫秒为单位的 Unix 时间。</bullet_item><para/>
        ///         <bullet_item>unix_s - Unix 时间（以秒为单位）。</bullet_item><para/>
        ///         <bullet_item>unix_hex - 十六进制的 Unix 时间。</bullet_item><para/>
        ///       </bulletList>
        ///     </bullet_item><para/>
        ///   </bulletList>
        ///   </para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Time Format")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _input_time_format { get; set; } = null;


        /// <summary>
        /// <para>Output Time Field</para>
        /// <para>The name of the output field in which the converted time values will be stored.</para>
        /// <para>将在其中存储转换时间值的输出字段的名称。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Time Field")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _output_time_field { get; set; }


        /// <summary>
        /// <para>Output Time Type</para>
        /// <para><xdoc>
        ///   <para>The data type of the output time field.</para>
        ///   <bulletList>
        ///     <bullet_item>Date—Date and/or time</bullet_item><para/>
        ///     <bullet_item>Text—Any string of characters</bullet_item><para/>
        ///     <bullet_item>Long (large integer)—Whole numbers between -2,147,483,648 and 2,147,483,647</bullet_item><para/>
        ///     <bullet_item>Short (small integer)—Whole numbers between -32,768 and 32,767</bullet_item><para/>
        ///     <bullet_item>Double (double precision)—Fractional numbers between -2.2E308 and 1.8E308</bullet_item><para/>
        ///     <bullet_item>Float (single precision)—Fractional numbers between -3.4E38 and 1.2E38</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>输出时间字段的数据类型。</para>
        ///   <bulletList>
        ///     <bullet_item>日期 - 日期和/或时间</bullet_item><para/>
        ///     <bullet_item>文本 - 任意字符串</bullet_item><para/>
        ///     <bullet_item>长整数（大整数）- 介于 -2,147,483,648 和 2,147,483,647 之间的整数</bullet_item><para/>
        ///     <bullet_item>短（小整数）- 介于 -32,768 和 32,767 之间的整数</bullet_item><para/>
        ///     <bullet_item>双精度（双精度）- 介于 -2.2E308 和 1.8E308 之间的小数</bullet_item><para/>
        ///     <bullet_item>浮点数（单精度）- 介于 -3.4E38 和 1.2E38 之间的小数</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Time Type")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _output_time_type_value _output_time_type { get; set; } = _output_time_type_value._DATE;

        public enum _output_time_type_value
        {
            /// <summary>
            /// <para>Date</para>
            /// <para>Date—Date and/or time</para>
            /// <para>日期 - 日期和/或时间</para>
            /// </summary>
            [Description("Date")]
            [GPEnumValue("DATE")]
            _DATE,

            /// <summary>
            /// <para>Text</para>
            /// <para>Text—Any string of characters</para>
            /// <para>文本 - 任意字符串</para>
            /// </summary>
            [Description("Text")]
            [GPEnumValue("TEXT")]
            _TEXT,

            /// <summary>
            /// <para>Long (large integer)</para>
            /// <para>Long (large integer)—Whole numbers between -2,147,483,648 and 2,147,483,647</para>
            /// <para>长整数（大整数）- 介于 -2,147,483,648 和 2,147,483,647 之间的整数</para>
            /// </summary>
            [Description("Long (large integer)")]
            [GPEnumValue("LONG")]
            _LONG,

            /// <summary>
            /// <para>Short (small integer)</para>
            /// <para>Short (small integer)—Whole numbers between -32,768 and 32,767</para>
            /// <para>短（小整数）- 介于 -32,768 和 32,767 之间的整数</para>
            /// </summary>
            [Description("Short (small integer)")]
            [GPEnumValue("SHORT")]
            _SHORT,

            /// <summary>
            /// <para>Double (double precision)</para>
            /// <para>Double (double precision)—Fractional numbers between -2.2E308 and 1.8E308</para>
            /// <para>双精度（双精度）- 介于 -2.2E308 和 1.8E308 之间的小数</para>
            /// </summary>
            [Description("Double (double precision)")]
            [GPEnumValue("DOUBLE")]
            _DOUBLE,

            /// <summary>
            /// <para>Float (single precision)</para>
            /// <para>Float (single precision)—Fractional numbers between -3.4E38 and 1.2E38</para>
            /// <para>浮点数（单精度）- 介于 -3.4E38 和 1.2E38 之间的小数</para>
            /// </summary>
            [Description("Float (single precision)")]
            [GPEnumValue("FLOAT")]
            _FLOAT,

        }

        /// <summary>
        /// <para>Output Time Format</para>
        /// <para><xdoc>
        ///   <para>The format in which the output time values will be saved. The list of output time formats depends on the output data type specified for the output time field. A custom format can also be used when the data type of the output time field is not Date. For a list of custom formats, see the explanation of Input Time Format.
        ///   <para>If the data type of the output time field isn't long enough to store the converted time value, the output value will be truncated.</para>
        ///   </para>
        /// </xdoc></para>
        /// <para><xdoc>
        /// <para>保存输出时间值的格式。输出时间格式列表取决于为输出时间字段指定的输出数据类型。当输出时间字段的数据类型不是“日期”时，也可以使用自定义格式。有关自定义格式的列表，请参阅输入时间格式的说明。
        ///   <para>如果输出时间字段的数据类型不够长，无法存储转换后的时间值，则输出值将被截断。</para>
        ///   </para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Time Format")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _output_time_format { get; set; } = null;


        /// <summary>
        /// <para>Updated Input Table</para>
        /// <para></para>
        /// <para></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Updated Input Table")]
        [Description("")]
        [Option(OptionTypeEnum.derived)]
        public object _out_table { get; set; }


        public ConvertTimeField SetEnv(object workspace = null)
        {
            base.SetEnv(workspace: workspace);
            return this;
        }

    }

}